const App = {
    mixins: [Query],//配置文件，路径/utils/mixins.js
    data() {
        return {
            page: {
                PageNumber: 1, //页码
                RowAmount: 10,
                Condition: window.btoa(unescape(encodeURIComponent("%%"))),
            },
        }
    },
    mounted() {

    },
    methods: {
        check() {
            if (this.page.value1) {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%" + this.page.value1 + "%")));
            } else {
                this.page.Condition = window.btoa(unescape(encodeURIComponent("%%")));
            }
            this.postgetList(this.page)
        },
        //树的点击筛选事件
        handleNodeClick(data, node) {

        },
        PlanList(row) {
            // let str = row["patrol_team_SerialNumber"];
            let { primary_key } = JSON.parse(
                document.getElementById("table").getAttribute("data-options")
            );
            window.location.href = "./index_taskPlan.html?action=Query&nodeKey=" + row[primary_key];
        },
        TaskAdd() {
            window.location.href = "./add.html?action=Add";
        },
        PlanMake(row) {
            // window.location.href = "./planMake.html?action=Modify";
            //校验是否已经存在计划记录,如果已存在则不执行

            $.ajax({

                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'patrol_taskPlan_Grid',
                    Condition: "Row_Status='0' and  Task_SerialNumber='" + row.Task_SerialNumber + "'",
                },
                success: (data) => {
                    if (data.length > 0) {
                        //已经存在
                        this.$message.error("已经存在巡逻计划，不可重复生成，请使用【巡逻计划下发】功能查看");
                        return;

                    } else {
                        //不存在
                        let { primary_key } = JSON.parse(
                            document.getElementById("table").getAttribute("data-options")
                        );
                        window.location.href = "./planMake.html?action=Modify&nodeKey=" + row[primary_key];
                    };
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",


            })


        }

    },
};

const { createApp } = Vue;
const app = createApp(App);
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.use(ElementPlus, { locale: zhCn });
app.mount("#app");
